// import { checkUserName, checkPassWord } from './utils/check.js'
import { checkUserName, checkPassWord } from 'Utils/check.js'
import './css/index.css'
import '@/less/index.less'
import axios from 'axios'
import logo from './assets/logo.png'

document.querySelector('.imgBox').src = logo

// alert(11111)
document.querySelector('.login-btn').addEventListener('click', () => {
  var username = document.querySelector('.username').value
  var password = document.querySelector('.password').value

  if (!checkUserName(username)) {
    alert('用户名输入的长度不够')
  }
  if (!checkPassWord(password)) {
    alert('密码输入的长度不够')
  }

  /* 发送请求 */
  axios({
    url: 'http://hmajax.itheima.net/api/register',
    method: 'POST',
    data: {
      username,
      password
    }
  }).then(result => {
    alert(result.data.message)
  }).catch(error => {
    alert(error.response.data.message)
  })
})

const arr = [1, 2, 3]
const result = arr.map(val => val + 1)
console.log(result)